name: Test

on:
  workflow_dispatch:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

env:
  TEST_DATABASE_URL: ${{secrets.TEST_DATABASE_URL}}

jobs:

  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3

    - name: Set up Go
      uses: actions/setup-go@v3
      with:
        go-version: 1.19
    
    - name: Set up Task
      run: go install github.com/go-task/task/v3/cmd/task@latest

    - name: Build Server
      run: task build

    - name: Test Server
      run: task test
      
